<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript">
        //编写一个JavaScript对象      es6语法： let const
        var user = {
            name:"chen",
            age:4,
            sex:"男"
        };
        console.log(user);          //控制台输出： Object { name: "chen", age: 4, sex: "男" }

        //将js对象解析为json对象
        var jsonObject = JSON.stringify(user);    //不需要导入任何包，前端自带的JSON
        console.log(jsonObject);    //控制台输出  {"name":"chen","age":4,"sex":"男"}

        var jsObject = JSON.parse(jsonObject);
        console.log(jsObject);     //Object { name: "chen", age: 4, sex: "男" }



    </script>
</head>
<body>

</body>
</html>